package member

import "github.com/gogf/gf/v2/frame/g"

type LoginReq struct {
	g.Meta    `path:"/member/login" method:"post" tags:"APP_MEMBER" summary:"授权_登录"`
	LoginType string `json:"login_type" v:"required|in:password,phone,email,googleOauth,yahooOauth#登录方式未知|登录方式不存在" dc:"必填 登录方式password（手机号或者邮箱作为用户名使用密码登录）,phone（手机号验证登录）,email（邮箱验证登录）,googleOauth（谷歌联登）"`
	Source    string `json:"source"     v:"in:Android,IOS,H5,WX_MINI#登录来源未知|登录来源不存在" dc:"必填 来源AndroidApp（安卓APP登录）,IosApp（IosApp登录）,H5（网页登录）Android,IOS,H5,WX_MINI"`
	Phone     string `json:"phone"      v:"required-if:login_type,phone|max-length:20#手机号未知|手机号长度限制" dc:"手机号"`
	AreaNo    string `json:"area_no"    v:"required-if:login_type,phone|max-length:10#手机国际区号未知|手机国际区号长度限制" dc:"区号"`
	Email     string `json:"email"      v:"required-if:login_type,email,googleOauth,yahooOauth|max-length:255#手机国际区号未知|手机国际区号长度限制"`
	Code      string `json:"code"       v:"required-unless:login_type,password,login_type,login_type,login_type,googleOauth,login_type,yahooOauth|length:6,6#验证码未知|验证码长度限制"`
	Password  string `json:"password"   v:"required-if:login_type,password|max-length:255#密码未知|密码长度限制" dc:"密码"`
	Referrer  int    `json:"referrer"   dc:"推荐人ID"`
	MdCode    string `json:"mdCode"     dc:"登录设备码"`
	MpModel   string `json:"mpModel"    dc:"登录设备型号"`
}

type LoginRes struct {
	Token     string `json:"token" dc:"用户token令牌身份"`
	Expires   int64  `json:"expires" dc:"用户token令牌有效期"`
	Replenish bool   `json:"isNewMember" dc:"是否新用户 true、未补充   false、已补充"`
}

type AuthIdBindLoginReq struct {
	g.Meta   `path:"/member/bindLogin" method:"post" tags:"APP_MEMBER" summary:"授权_登录绑定"`
	BindType string `json:"bindType" v:"required|in:PHONE,phone,EMAIL,email,WX_MINI,wx_mini#绑定类型未知|绑定类型格式错误" dc:"绑定类型phone,email,WX_MINI"`
	AuthId   string `json:"authId"   v:"required#授权ID标识未知" dc:"授权ID标识"`
	Email    string `json:"email"    v:"required-if-all:bindType,EMAIL,bindType,email|email#邮箱未知|邮箱格式错误" dc:"邮箱"`
	Code     string `json:"code"     v:"required#验证码未知" dc:"验证码"`
	Phone    string `json:"phone"    v:"required-if-all:bindType,PHONE,bindType,phone,bindType,WX_MINI|max-length:20#手机号未知|手机号长度限制" dc:"手机号"`
	AreaNo   string `json:"area_no"  v:"required-if-all:bindType,PHONE,bindType,phone,bindType,WX_MINI|max-length:10#手机国际区号未知|手机国际区号长度限制" dc:"区号 +86"`
	Source   string `json:"source"   v:"required|in:Android,IOS,H5,WX_MINI#来源未知|来源格式错误" dc:"来源"`
	Referrer int    `json:"referrer" dc:"推荐人ID"`
	MdCode   string `json:"mdCode"     dc:"登录设备码"`
	MpModel  string `json:"mpModel"    dc:"登录设备型号"`
}

type AuthIdBindLoginRes struct {
	Token     string `json:"token" dc:"用户token令牌身份"`
	Expires   int64  `json:"expires" dc:"用户token令牌有效期"`
	Replenish bool   `json:"isNewMember" dc:"是否新用户 true、未补充   false、已补充"`
}
